//
//  AboutViewController.m
//  LoanOne
//
//  Created by WangZhenyu on 2017/10/18.
//  Copyright © 2017年 WangZhenyu. All rights reserved.
//

#import "AboutViewController.h"
#import "LoadConfig.h"

@interface AboutViewController ()
@property (weak, nonatomic) IBOutlet UILabel *versionLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *info1Label;
@property (weak, nonatomic) IBOutlet UILabel *info2Label;
@property (weak, nonatomic) IBOutlet UILabel *info3Label;
@property (weak, nonatomic) IBOutlet UILabel *appNameLabel;

@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"关于我们";
    if (self.foraml) {
        [self addBackBtn];
    }else{
        [self addBlackBackBtn];
    }
    self.versionLabel.text = [NSString stringWithFormat:@"当前版本：V%@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
    self.appNameLabel.text = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
    NSDictionary *configDic = [[LoadConfig shareStance] getAbout];
    if (configDic.count > 0) {
        [self showContent:configDic];
    }
    [[LoadConfig shareStance] loadAboutSuccess:^(NSDictionary *dic) {
        [self showContent:dic];
    }];
    
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)showContent:(NSDictionary *)dic{
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"icon"]]];
    self.info1Label.text = [dic objectForKey:@"description1"];
    self.info2Label.text = [dic objectForKey:@"description2"];
    self.info3Label.text = [dic objectForKey:@"description3"];
}

@end
